<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Richieste amicizia</title>
</head>
<body>
<a href="Homepage.jsp">Logout</a>
<p>Richieste di amicizia</p>



	<p>
		<%
		out.println("<form name = \" TornaProfilo\" method = \"post\" action = \"ProfiloServlet\">");
		out.println("<input type = \"hidden\" name = \"idSessione\" value=\"" + request.getAttribute("idSessione") + "\">");
		out.println("<input type = \"hidden\" name = \"idRichiesta\" value=\"" + request.getAttribute("idSessione") + "\">");
		out.println("<input type = \"submit\" value = \"Torna al profilo\">");
		out.println("</form>");
			int numeroamicizie = Integer.parseInt(request.getAttribute("numeroAmicizie").toString());
		if(numeroamicizie == 0)
			out.println("non ci sono richieste di amicizia");
		else
		{
			for(int i=0; i<numeroamicizie; i++)
			{   
				out.println(request.getAttribute("idmandante" + i));
				out.println(request.getAttribute("nomemandante" + i));
				out.println(request.getAttribute("cognomemandante" + i));
				out.println("\n");
				out.println(request.getAttribute("idricevente" + i));
				out.println(request.getAttribute("nomericevente" + i));
				out.println(request.getAttribute("cognomericevente" + i));
				out.println("<form name = \" AccettaAmicizia\" method = \"post\" action = \"AccettaAmiciziaServlet\">");
				out.println("<input type = \"hidden\" name = \"idmandante\" value=\"" + request.getAttribute("idmandante" + i) + "\">");
				out.println("<input type = \"hidden\" name = \"idricevente\" value=\"" + request.getAttribute("idricevente" + i) + "\">");
				out.println("<input type = \"hidden\" name = \"richiesta\" value=\"accetta\">");
				out.println("<input type = \"submit\" value = \"Accetta\">");
				out.println("</form>");
				out.println("<form name = \" RifiutaAmicizia\" method = \"post\" action = \"AccettaAmiciziaServlet\">");
				out.println("<input type = \"hidden\" name = \"idmandante\" value=\"" + request.getAttribute("idmandante"+ i) + "\">");
				out.println("<input type = \"hidden\" name = \"idricevente\" value=\"" + request.getAttribute("idricevente"+ i) + "\">");
				out.println("<input type = \"hidden\" name = \"richiesta\" value=\"rifiuta\">");
				out.println("<input type = \"submit\" value = \"Rifiuta\">");
				out.println("</form>");
			
			}
		}
		
		
		%>
	</p>
	
</body>
</html>